package _0492_Construct_the_Rectangle;

import java.util.Arrays;

/**
 * Date: 2021/9/21 10:05
 * Content:
 * 执行用时：1 ms, 在所有 Java 提交中击败了44.31%的用户
 * 内存消耗：35.8 MB, 在所有 Java 提交中击败了65.15%的用户
 */
public class Solution {

    public int[] constructRectangle(int area) {
        int L = area, W = 1;
        for (int i = 1; i <= area / i; i++)
            if (area % i == 0) {
                L = area / i;
                W = i;
            }
        return new int[]{L, W};
    }

    public static void main(String[] args) {

        System.out.println(Arrays.toString((new Solution()).constructRectangle(4)));
        System.out.println(Arrays.toString((new Solution()).constructRectangle(5)));
    }
}
